import fetch from 'common/src/utils/fetch';


/**
 * 查询列表
 */
function searchList(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/page',
        method: 'post',
        data: data
    });
}


function exportList(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/export',
        method: 'post',
        data: data
    });
}

function graduateExportList(data) {
    return fetch({
        url: '/api/arrangementservice/manualArrange/graduateExportList',
        method: 'post',
        data: data
    });
}

function exportMoreList(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/exportMoreList',
        method: 'post',
        data: data
    });
}

function getResultByKey(key) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/result/' + key,
        method: 'get',
    });
}

function getResultByKeyWithOutPre(key) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/resultWithOutPre/' + key,
        method: 'get',
    });
}

function findArrangingCourses(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/findArrangingCourses',
        method: 'post',
        data: data
    });
}

function exportArrangingCourses(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/exportArrangingCourses',
        method: 'post',
        data: data
    });
}

function findTeachingClss(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/findTeachingClss',
        method: 'post',
        data: data
    });
}

function findCourses(calendarId, courseCode, deployFlag) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/findCourseOpenList',
        params: {
            courseCode: courseCode,
            calendarId: calendarId,
            deployFlag: deployFlag
        },
        method: 'get'
    });
}

function findTeachingClssInfo(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/findTeachingClssInfo',
        method: 'post',
        data: data
    });
}

function findTeachingClssInfoAndTime(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/findTeachingClssInfoAndTime',
        method: 'post',
        data: data
    });
}

function findOpenCourse(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/findOpenCourse',
        method: 'post',
        data: data
    });
}

function checkIsChanging(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClassChange/checkIsChanging',
        method: 'post',
        data: data
    });
}

function getResultByKeyForFaculty(key) {
    return fetch({
        url: '/api/arrangementservice/assistData/workload/result/' + key,
        method: 'get',
    });
}

function searchTaskList(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/taskClassPage',
        method: 'post',
        data: data
    });
}

function closeTask(id) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/closeTeachingTask',
        params: {
            classId: id
        },
        method: 'get'
    });
}

function reopenTask(id) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/reopenTeachingTask',
        params: {
            classId: id
        },
        method: 'get'
    });
}

/**
 * 直接调用选课接口
 * @param {*} id 教学班id
 * @param {*} status 教学班状态
 *
 */
function updateTaskStatus(id, status) {
    return fetch({
        url: '/api/electionservice/elcCourseTake/withdrawByTeachingClassId',
        params: {
            teachingClassId: id,
            status: status
        },
        method: 'get'
    });
}

/**
 * 根据年级、专业代码查询专业学院
 * @param {*} grade
 * @param {*} professionCode
 */
function searchProfessionalColleage(grade, professionCode) {
    return fetch({
        url: '/api/baseresservice/campusProfession/findProfessionByParam',
        data: {
            campusProfession: professionCode,
            grade: grade
        },
        method: 'post'
    });
}

/**
 * 研究生教师工作量查询
 */
function findGraduateTeachingSituation(data) {
    return fetch({
        url: '/api/arrangementservice/teachingClass/findGraduateTeachingSituation',
        method: 'post',
        data: data
    });
}

export default {
    'searchList': searchList,
    'exportList': exportList,
    'getResultByKey': getResultByKey,
    'findArrangingCourses': findArrangingCourses,
    'exportArrangingCourses': exportArrangingCourses,
    'findTeachingClss': findTeachingClss,
    'findTeachingClssInfo': findTeachingClssInfo,
    'findOpenCourse': findOpenCourse,
    'findCourses': findCourses,
    'checkIsChanging': checkIsChanging,
    'findTeachingClssInfoAndTime': findTeachingClssInfoAndTime,
    'getResultByKeyForFaculty': getResultByKeyForFaculty,
    'searchTaskList': searchTaskList,
    'closeTask': closeTask,
    'reopenTask': reopenTask,
    'exportMoreList': exportMoreList,
    'getResultByKeyWithOutPre': getResultByKeyWithOutPre,
    'graduateExportList': graduateExportList,
    'searchProfessionalColleage': searchProfessionalColleage,
    'updateTaskStatus':updateTaskStatus,
    'findGraduateTeachingSituation': findGraduateTeachingSituation
};
